package cn.sstir.hackathon.controller;

import cn.sstir.hackathon.core.CompanyExportMap;
import cn.sstir.hackathon.core.PaperExportMap;
import cn.sstir.hackathon.core.PatentExportMap;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

/**
 * @author: fli
 * @email: fli@sstir.cn
 * @date: 2020/1/16 18:10
 */
@Controller
public class IndexController {


    @RequestMapping({"","/index"})
    public String index(String keyword, Model model){
            model.addAttribute("keyword",keyword);
            return "list.html";
    }

    @RequestMapping("/index/exportResult")
    public String exportHtml(Model model) {
        PaperExportMap paperExportMap = new PaperExportMap();
        PatentExportMap patentExportMap = new PatentExportMap();
        CompanyExportMap companyExportMap = new CompanyExportMap();
        Map<String, String> paperFieldMap = paperExportMap.getDictory();
        Map<String, String> patentFieldMap = patentExportMap.getDictory();
        Map<String, String> companyFieldMap = companyExportMap.getDictory();
        model.addAttribute("paper_field_map",paperFieldMap);
        model.addAttribute("patent_field_map",patentFieldMap);
        model.addAttribute("company_field_map",companyFieldMap);
        return  "export.html";
    }
}
